package emergence.game.gfx;

public class BasicSprite extends Sprite {

	public BasicSprite(int[] pixels, int width, int height) {
		
		int[][] pixels2D = new int[width][height];
		for (int i = 0; i < width; i++) {
			for (int j = 0; j < width; j++) {
				pixels2D[i][j] = pixels[i + (j * width)];
			}
		}
		
		init(pixels2D, width, height);
	}
	
	
	public BasicSprite(int[][] pixels) {
		init(pixels, pixels.length, pixels[0].length);
	}
	
	
	public Sprite flip(boolean flipX, boolean flipY) {
		int[][] newPixels = new int[width][height];
		
		if (flipX) {
//			for (int i = 0; i <  width; i++) {
//				for (int j = 0; j < width; j++) {
//					newPixels[i][j] = pixels[i][height - j - 1];
//				}
//			}
		}
		if (flipY) {
			for (int i = 0; i <  width; i++) {
				for (int j = 0; j < width; j++) {
					newPixels[i][j] = pixels[width - i - 1][j];
				}
			}
		}
		
		return new BasicSprite(newPixels);
	}

}
